#pragma once

#include"Agreement.hpp"
#include <iostream>
#include <string>


class RecKoner
{
public:
    RecKoner() = default;
    ~RecKoner() = default;


    Response Calculate(const Request& req)
    {
        int res = 0;
        int code = 0;
        switch (req.GetOper())
        {
        case '+':
            res = req.GetX() + req.GetY();
            break;
        case '-':
            res = req.GetX() - req.GetY();
            break;
        case '*':
            res = req.GetX() * req.GetY();
            break;
        case '/':
            if(req.GetY() == 0)
            {
                code = 1;
            }
            else
            {
                res = req.GetX()/req.GetY();
            }
            break;
        default:
            code = 2;
            break;
        }

        return Response(res,code);
    }

};